// 动态表单

<template>
    <div class="v-dynamic-forms">
        <template v-for="(item, index) in arr">
            <template v-if="item.filedType == 'input'">
                <v-input :key="index"
                         :typeList="typeList"
                         :confList="confList"
                         :valueList="valueList"
                         :riskListId="riskListId"
                         :typeItem="item"
                         :disabled="disabled">
                </v-input>
            </template>

            <template v-if="item.filedType == 'checkbox'">
                <v-checkbox :key="index"
                            :typeList="typeList"
                            :confList="confList"
                            :valueList="valueList"
                            :riskListId="riskListId"
                            :typeItem="item"
                            :disabled="disabled">
                </v-checkbox>
            </template>
        </template>
    </div>
</template>

<script>
import vInput from './components/input.vue'
import vCheckbox from './components/checkbox.vue'


export default {
    props: {
        // 主键
        riskListId: {
            type: String,
            default: ''
        },
        // 接口返回的数据
        typeList: {
            type: Array,
            default: _ => ([])
        },
        // 接口返回的数据
        confList: {
            type: Array,
            default: _ => ([])
        },
        // 接口返回的数据
        valueList: {
            type: Array,
            default: _ => ([])
        },
        // 是否禁用
        disabled: {
            type: Boolean,
            default: false
        }
    },
    components: {
        vInput,
        vCheckbox
    },
    computed: {
        arr () {
            return this.typeList
        }
    }
}
</script>
